BIN=ok
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)
CC=gcc 
RM=rm -f


$(BIN):$(OBJ)
	@$(CC) $^ -o $@
	@echo "链接 $^ 成 $@"
%.o:%.c
	@$(CC) -c $<
	@echo "编译 $< 成 $@"

.PHONY:clean
clean:
	$(RM) $(OBJ) $(BIN)
	
.PHONY:test 
test:
	@echo $(SRC)
	@echo $(OBJ)






#o(BIN):$(OBJ)
#	$(CC) $(OBJ) -o $(BIN) 
#$(OBJ):$(SRC)
#	$(CC) -c $(SRC) -o $(OBJ)
#
#
#.PHONY:clean
#clean:
#	$(RM) $(OBJ) $(BIN)


#ok:test.o
#	gcc test.o -o ok
#test.o:test.s
#	gcc -c test.s -o test.o
#test.s:test.i
#	gcc -S test.i -o test.s
#test.i:test.c
#	gcc -E test.c -o test.i
#
#
#.PHONY:clean
#clean:
#	rm -f *.i *.s *.o ok 
#
